home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _SPLITPL.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  63 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef        NDEBUG
  5. char *rcsid__splitpl = "$Header: c:/curses/private/RCS/_splitpl.c%v 2.0 1992/11/15 03:24:41 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10. #ifdef FLEXOS
  11. /*man-start*********************************************************************
  12.  
  13.   _flexos_split_plane()        - splits a char/attr plane into separate planes
  14.  
  15.   PDCurses Description:
  16.        This is a private PDCurses function.
  17.  
  18.        This routine is used only be the Flexos platform.
  19.  
  20.        This routine will separate the character/attributes plane into
  21.        a separate character and attribute plane.
  22.  
  23.   PDCurses Return Value:
  24.        This function returns OK upon success otherwise ERR is returned.
  25.  
  26.   PDCurses Errors:
  27.        It is an error to pass a NULL WINDOW pointer.
  28.        It is also an error if the starting x or y coordinate exceeds the
  29.        passed window boundaries.
  30.  
  31.   Portability:
  32.        PDCurses        int     _flexos_split_plane( WINDOW* w,
  33.                                        char* chr, char* attr,
  34.                                        int sy, int sx,
  35.                                        int ey, int ex );
  36.  
  37. **man-end**********************************************************************/
  38.  
  39. int    _flexos_split_plane(WINDOW* w,char* chr,char* attr,int sy,int sx,int ey,int ex)
  40. {
  41.        int     l;
  42.        int     c;
  43.  
  44.        if (w == (WINDOW *)NULL)                return( ERR );
  45.        if (sy > w->_maxy)      return( ERR );
  46.        if (sx > w->_maxx)      return( ERR );
  47.        if (ey > w->_maxy)      ey = w->_maxy - 1;
  48.        if (ex > w->_maxx)      ex = w->_maxx - 1;
  49.  
  50.        for (l = sy; l <= ey; l++)
  51.        {
  52.                for (c = sx; c <= ex; c++)
  53.                {
  54.                        *chr  = (char)(w->_y[l][c] & CHR_MSK);
  55.                        *attr = (char)(w->_y[l][c] & ATR_MSK) >> 8;
  56.                        chr++;
  57.                        attr++;
  58.                }
  59.        }
  60.        return( OK );
  61. }
  62. #endif
  63.